#pragma once
#include "Command.h"
#include <QMap>

class CmdMgr
{
public:
	static CmdMgr& instance();
	bool initialize();
	void unInitialize();

	void loadQBMenu(); 
	void loadQBWoptions();
	void loadClickPageConfig(bool isSave = false);

	bool execCmd(int id);
	bool execCmd(int id, const QString& paras);

	int cmdWindowId();//tab id or top window id
	Command* command(int id);

	void removePageRedPoint(int id);

	void addCommonPage(int id);
	void setCommonPages(int* ids, int size);
	bool isCommonPage(int id);
	void removeCommonPage(int id);
	const QVector<int>& commonPages() { return m_commonPages; }
	void setIasMenu(const QString& iasmenu);
	const QString& getIasMenu() { return m_iasmenu; }

private:
	CmdMgr();
	void LoadCmdConfig();

private:
	QMap<int, Command>	m_cmds;
	QSet<int>			m_noRedpages;
	QVector<int>		m_commonPages;
	QString				m_iasmenu;
};
